# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: 

inherit eutils

DESCRIPTION="NetAMS Traffic Accounting"
SRC_URI="http://www.netams.com/files/netams-3.2.2.tar.gz"
SLOT="0"
LICENSE="GPL-2"
KEYWORDS="x86"
RDEPEND="dev-db/mysql net-libs/libpcap"

src_unpack() {
    unpack ${P}.tar.gz
    EPATCH_OPTS="-p1 -d ${P}" epatch ${FILESDIR}/netams-ds-portrange.patch
}

src_compile() {
    ./configure.sh
    make
}

src_install() {
    into /usr
    mkdir -p ${D}/usr/local/sbin
    mkdir -p ${D}/etc/init.d

    install -m 0755 ${FILESDIR}/netams.init ${D}/etc/init.d/netams
    install -m 0755 src/flowprobe ${D}/usr/local/sbin/
    install -m 0755 src/ipfw2netflow ${D}/usr/local/sbin/
    install -m 0755 src/ulog2netflow ${D}/usr/local/sbin/
    install -m 0755 src/netams ${D}/usr/local/sbin/
    install -m 0755 src/netamsctl ${D}/usr/local/sbin/
}
